package cn.hchaojie.camp.javafx.part0;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class HelloFx extends Application {

	@Override
	public void start(Stage primaryStage) {
		Button btn = new Button();
		btn.setText("JavaFx大法好！");
		btn.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				System.out.println("点到我了！");
			}
		});
		
		HBox hbox = new HBox();
		hbox.getChildren().add(btn);

		Scene scene = new Scene(hbox, 300, 150);

		primaryStage.setTitle("Hello World JavaFx!");
		primaryStage.setScene(scene);
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch(args);
	}
}